<?php
/**
 * @package		Joomla.Site
 * @subpackage	mod_menu
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// No direct access.
defined('_JEXEC') or die;
$class = $params->get('newsClass');
$nbwrap	= 100;
if ($class){
?>
<style>
.newsBackground{
	background:#eeeeee;
	padding: 10px;
}
.newsBackground a.title_color{
	color: #024ec6;	
}
.newsBackground .imageTipSpance{
	border: 7px solid #c3c3c3;
}
</style>
<?php 
$nbwrap = 150;
}?>
<div <?php echo ($class) ? "class='".$class."'" : ""?>>
	<?php if ( !$class ){?>
    <div class="head-title">
		<h2><?php echo $params->get('htitle');?></h2>
	</div>
    <?php }else{?>
    	<h3 style="font-size:18px"><?php echo $params->get('htitle');?></h3>
    <?php }?>
    <?php if ( !empty($cat1) ){ 
		$width1 = (!empty($cat2)) ? "width : 47%" : "width : 100%";
	?>
	<div style="float: left;<?php echo $width1?>">
    	<div style="float:left;">
        	<?php $imagePath = Utilities::renderthumbnail($cat1->images);?>
            <?php if ($imagePath){?>          
			<img src="<?php echo $imagePath?>" width="150" height="115" align="left" style="margin-right:15px;" class="<?php echo $class ? "imageTipSpance" : ""?>" />
			<?php }?>
        </div>
      	<div style="float:left;width:170px">
        	<h3><a href="index.php?option=com_content&view=article&id=<?php echo $cat1->id?>&Itemid=123" class="<?php echo $class ? "title_color" : ""?>"><?php echo $cat1->title?></a></h3>
        	<?php echo modNewsHelper::wrapText($cat1->introtext, $nbwrap)?>
        	<div style="padding-top:5px;"><a href="index.php?option=com_content&view=article&id=<?php echo $cat1->id?>&Itemid=123" class="<?php echo $class ? "title_color" : ""?>"><?php echo JText::_('readmore');?></a></div>
     	</div>
    </div>
    <?php }?>
    <?php if ( !empty($cat2) ){ 
		$width2 = (!empty($cat1)) ? "width : 47%" : "width : 100%";
	?>
    <div style="float: right;<?php echo $width2?>">    	    	
    	<div style="float:left;">
        	<?php $imagePath = Utilities::renderthumbnail($cat2->images);?>
            <?php if ($imagePath){?>          
			<img src="<?php echo $imagePath?>" width="150" height="115" style="margin-right:15px;"  class="<?php echo $class ? "imageTipSpance" : ""?>" />
			<?php }?>
        </div>  
        <div style="float:left;width:170px">
        	<h3><a href="index.php?option=com_content&view=article&id=<?php echo $cat2->id?>&Itemid=123" class="<?php echo $class ? "title_color" : ""?>"><?php echo $cat2->title?></a></h3>
        	<?php echo modNewsHelper::wrapText($cat2->introtext, $nbwrap)?>
        	<div style="padding-top:5px;"><a href="index.php?option=com_content&view=article&id=<?php echo $cat2->id?>&Itemid=123" class="<?php echo $class ? "title_color" : ""?>"><?php echo JText::_('readmore');?></a></div>
       	</div>        
        
    </div>
    <?php }?>
    <div style="clear:both"></div>
</div>
